I have this query:
select a.id AS testid, b.id as test2id from connector a LEFT JOIN connector_status b ON a.id = b.id where a.id = 99999
I want to retrieve metadata from the resultset with this code:
Statement st = conn.createStatement();
st.setMaxRows(1);
ResultSet rs = st.executeQuery(query);
ResultSetMetaData meta = rs.getMetaData();
int columns = meta.getColumnCount();
for (int i = 1; i <= columns; i++) {
System.out.println("Name: " + meta.getColumnName(i));
System.out.println("Label: " + meta.getColumnLabel(i));
}
I get this result:
Name: testid
Label: testid
Name: test2id
Label: test2id
What am I doing wrong? getColumnName() should return id, or am I wrong?
Best regards
Peter